<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,user-scalable=no,minimum-scale=1,initial-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="applicable-device" content="mobile">
    <title>{$info.title}</title>
    <script type="text/javascript" src="__PUBLIC__/js/do.js" charset="utf-8"></script>
    <script type="text/javascript" src="__PUBLIC__/js/moble.js" charset="utf-8"></script>
    <link rel="stylesheet" href="__STATIC__/allwin/unmarket/style.css" />
</head>
<body ontouchstart>
<div id="content-item">
    <div class="page3">
        <div class="untitle">专属于你的福利</div>
        <div class="unname">赶快到店里核销吧</div>
        <div class="untips">每人仅限使用一次</div>
    </div>
    <div class="page2">
        <div class="timelogo"><img src="__STATIC__/allwin/unmarket/overtime.png" /></div>
        <div class="timetitle">兑换时间</div>
        <div class="endtime">{$info.start_time|date="Y-m-d"} 至 {$info.end_time|date="Y-m-d"}</div>
    </div>
    {if count($store) >= 1}
    <div class="page3">
        <div class="uncontent">
            <ul class="store">
                {foreach $store as $rs}
                <li>
                    <div class="order {if in_array($rs.id,$order)}okpass{else}dopass{/if}" id="{$rs.id}" store="{$rs.name}">{if in_array($rs.id,$order)}已用{else}兑换{/if}</div>
                    <div class="store-img"><img src="{$rs.img}"></div>
                    <div class="store-name">
                        <p class="h1">{$rs.name}</a></p>
                        <p class="h2 tel"><a href="tel:{$rs.telphone}">电话:{$rs.telphone}</a></p>
                        <p class="h2 address">{$rs.address}</p>
                    </div>
                    <div class="store-text">{$rs.content|dehtml|raw}</div>
                </li>
                {/foreach}
            </ul>
        </div>
    </div>
    {/if}
</div>
<!-- 分享 -->
<div id="item-btm"></div>
<!-- 联系我们 -->
<div id="contact_popup" class="weui-popup__container popup-bottom">
    <div class="weui-popup__overlay"></div>
    <div class="weui-popup__modal">
        <div class="toolbar"><div class="toolbar-inner"><a href="javascript:;" class="picker-button close-popup">关闭</a><h1 class="title">联系客服</h1></div></div>
        <div class="modal-content">
            <div class="weui-msg">
                <div class="weui-msg__icon-area"><img src="{$info.mycode}" style="width: 10em;"></div>
                <div class="weui-msg__text-area">
                    <h2 class="weui-msg__title">电话:{$info.telphone}</h2>
                    <p class="weui-msg__desc">{$info.tips}</p>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 购物栏 -->
<script id="btm_tpl" type="text/html">
    <div class="btn btn-gray"><a href="{:urls('allwin/unmarket/index',$member_miniapp_id,['id'=>$info.id])}"><span>返回活动</span></a></div>
    <div class="btn"><a href="javascript:;" class="open-popup" data-target="#contact_popup"><span>联系客服</span></a></div>
</script>
<script type="text/javascript">
Do('weui','fastclick','jweixin','slide','tpl',function(){
    $(function(){
        FastClick.attach(document.body);
    });
    $("#item-btm").html(template("btm_tpl"))
    $(".dopass").click(function(){
        var id = $(this).attr('id');
        var store = $(this).attr('store');
        $.confirm("仅一次机会,建议到店核销,您确认要核销掉【"+store+'】提供的福利吗?', function() {
            $.confirm("防止误操作,请再次点击确认", function() {
                $.post("{:urls('allwin/unmarket/order',$member_miniapp_id,['id' => $info.id])}",{store_id:id},function(rel){
                    if(rel.code == 200){
                        $.alert(rel.msg,function(){
                            window.location.reload()
                        });
                    }else{
                        $.alert(rel.msg);
                    }
                });
            })
        }, function() {
            $.alert("建议到店当面确认核销");
        });
    });
});
</script>
</body>
</html>